import jakarta.servlet.*;
import jakarta.servlet.annotation.WebFilter;

import java.io.IOException;
import java.io.PrintWriter;

@WebFilter("/b")
public class MyFilter01 implements Filter {
    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {

        servletResponse.setContentType("text/html;charset=UTF-8");
        PrintWriter out = servletResponse.getWriter();
        out.println("MyFilter01 放行前逻辑<br/>");
        filterChain.doFilter(servletRequest, servletResponse);  //放行
        out.println("MyFilter01 放行后逻辑<br/>");
    }
}